/*
 * @Description:
 * @Version: 2.0
 * @Autor: snzo.chen
 * @Date: 2023-11-30 16:48:28
 * @LastEditors: snzo.chen
 * @LastEditTime: 2023-12-04 11:10:37
 */
import { request } from '@/utils/request';

/**
 * 添加
 * @param data
 * @returns
 */
export function addAuth(data: API.AuthItem) {
  return request<API.BaseResult>(
    {
      url: '/auth/addAuth',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

/**
 * 删除
 * @param params
 * @returns
 */
export function deleteAuth(params: API.AuthItem) {
  return request<API.BaseResult>(
    {
      url: '/auth/deleteAuth',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

/**
 * 按Id查询
 * @param params
 * @returns
 */
export function selectAuthById(params: API.AuthItem) {
  return request<API.AuthItem>(
    {
      url: '/auth/selectAuthById',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 查询所有
 * @returns
 */
export function selectAllAuth() {
  return request<API.AuthItem[]>(
    {
      url: '/auth/selectAllAuth',
      method: 'get',
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 分页获取数据
 * @param params
 * @returns
 */
export function selectAllByPage(params: API.PageParams) {
  return request<API.SeachResult<API.AuthItem[]>>(
    {
      url: '/auth/selectAllByPage',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 更新
 * @param data
 * @returns
 */
export function updateAuth(data: API.AuthItem) {
  return request<API.BaseResult>(
    {
      url: '/auth/updateAuth',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}
